const Service = require('egg').Service;

class NewsService extends Service {
  async list() {
    const { serverUrl } = this.config.news;
    // const { logger } = this.app;
    // const { logger } = this.ctx;
    const { logger } = this;

    const result = await this.ctx.curl(`${serverUrl}?${Date.now()}`);
    // console.log(111, result);
    // logger.info(result);
    // logger.debug(JSON.parse(result.data));
    // console.log(222, JSON.parse(result.data));
    // return JSON.parse(result.res.data).otherNews;
    return JSON.parse(result.data).otherNews;
  }
}

module.exports = NewsService;